<template>
  <view
    :class="{actionBtn: true, actionBtn0: position == 0, actionBtn1: position == 1, actionBtn2: position == 2, actionBtn3: position == 3 }"
    v-if="$orderModuleShowActionBtn(position)"
    @click.stop="clickHandler"
  >修改地址</view>
</template>

<script>
// 修改地址组件
import { checkPosition, getOrderId } from "../utils/checkShowBtn"

export default {
  name: "modifyAddress",
  
  props: {
    order: {
      type: Object,
      default: {},
    }, // 订单对象
    isUsedInList: {
      type: Boolean,
      default: true,
    }, // 是否使用在订单列表页面
  },
  
  data() {
    return {}
  },

  computed: {
    position: function() {
      return checkPosition.xiugaidizhi(this.order, this.isUsedInList)
    }
  },
  
  methods: {
    /**
     * 按钮点击跳转到修改地址页面
     */
    clickHandler: function() {
      const orderId = getOrderId(this.order)
      this.$onTo(`/pages/setAddress/setAddress?orderId=${orderId}`)
    }
  }
}
</script>

<style>
</style>
